package com.wing.financeSet.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 凭证类别
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("fin_voucher_type")
public class VoucherType extends BaseEntity<VoucherType> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum AstrictType implements IEnum<Integer> {

        /**
        * 无限制
        */
        not(0,"无限制"),
        /**
        * 借方必有
        */
        debtorHave(1,"借方必有"),
        /**
        * 贷方必有
        */
        loanHave(2,"贷方必有"),
        /**
        * 借方必无
        */
        debtorNot(3,"借方必无"),
        /**
        * 贷方必无
        */
        loanNot(4,"贷方必无"),
        /**
        * 凭证必有
        */
        voucherHave(4,"凭证必有"),
        /**
        * 凭证必无
        */
        voucherNot(5,"凭证必无");

        private int code;
        private String desc;

        AstrictType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 科目分类id
     */
    private Long subjectCategoryId;

    /**
     * 凭证类别名称
     */
    private String name;

    /**
     * 凭证字
     */
    private String voucherWord;

    /**
     * 单据编号头
     */
    private String documentCode;

    /**
     * 限制类型
     */
    private AstrictType astrictType;

    /**
    * 限制类型描述
    */
    @TableField(exist = false)
    private String astrictTypeDesc;

    public String getAstrictTypeDesc() {
        return astrictType == null ? null : astrictType.getDesc();
    }

    /**
     * 限制科目
     */
    private String restrictiveSubjects;
    private Boolean isDeleted;
    private String remark;
}
